{extend name="public/base" /}
    {block name="content"}
        <section class="content-header">
<h1>栏目列表<small>Column List</small></h1>
<ol class="breadcrumb">
	<li><a href="{:U('Index/index')}">
	<i class="fa fa-dashboard"></i> 首页</a>
	</li>
	<li class="active">栏目列表</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
	<div class="col-xs-12">
		<div class="box">
			<div class="box-header ">
				<h3 class="box-title pad">
				<a href="{:U('Term/index')}" class="btn btn-primary">栏目管理</a>&nbsp;&nbsp;
				<a href="{:U('Term/addTerm')}" class="btn btn-primary">添加栏目</a>&nbsp;&nbsp;
				<!-- <a href="{:U('Term/addTerm')}" class="btn btn-primary">更新栏目缓存</a>&nbsp;&nbsp; -->
				</h3>
			</div>
			<!-- /.box-header -->
			 <form method="POST" action="{:U('Term/listorder')}" target="_self">
			<div class="box-body">
			   <div class="box">
			     <table class="table table-bordered table-hover">
				<!-- 列表头部 -->
				<thead>
				<tr>
					<th width="20" align="left">
						<input  name="deletec" id="deletec" type="checkbox"/>
					</th>
					<th width="40" align="left">排序</th>
					<th width="40" align="left">ID</th>
					<th width="400" align="left">栏目名称</th>
					<th width="120" align="left">栏目类型</th>
					<th width="150" align="left">模型</th>
					<th width="45" align="center">导航</th>
					<th>操作</th>
				</tr>
				</thead>
				<!-- 列表头部 -->
				<!-- 循环列表 -->
				
				<tbody style="border:none">
                <style>
                    .hasChild{
                        cursor: pointer;
                    }
                </style>
                {include file="term/getchild" /}
				<tr>
					<td colspan="10" align="left">
						<input type="submit" class="btn btn-primary" value="删除" name="delete"/>&nbsp;<input type="submit" class="btn btn-primary" value="排序" />&nbsp;&nbsp;
						<span style="color: #959595;"><span class="badge bg-aqua">!</span>&nbsp;友情提示：排序方式为“从大到小”</span>
					</td>
				</tr>
				</tbody>
				
				<!-- 循环列表 END -->
				</table>

                   <script>
                       $("body").on('click', '.hasChild', function() {
                           var id = $(this).attr("id").replace("term_id_", "");
                           var childNode = $(".parent_id_" + id);

                           $("#term_img_" + id).attr("src","__ADMINLTE__dist/img/colum1nx2.gif");
                           if (childNode.html()) {
                               if(childNode.first().is(':visible')){
                                   childNode.hide();
                                   $("#term_img_" + id).attr("src","__ADMINLTE__dist/img/colum1nx.gif");
                               }else{
                                   childNode.show();
                               }
                           } else{
                               $.post('{:U("Term/getchild")}', {
                                   parent_id: id
                               }, function(data, textStatus, xhr) {
                                   $("#node_" + id).after(data);
                               });
                           }
                       });
                   </script>
			   </div>

			</div>
			</form>
			
		</div>
	</div>
</div>


 <script language="javascript" type="text/javascript">
 
$(document).ready(function(){


     <!-- 导航显示开始-->
	$(".display_nav").click(function(){
		   if($('.display_nav').is(':checked')) {
            	   
			$.ajax({  
			  type:"post",  
			  url:"{:U('Term/displaynav')}",  
			  dataType: "json",
			  data:{
			      displaynav:1, 
				  navid:$(this).val(), 
			    },  
                 });
			alert('导航显示成功');	
		 }else{
		 	$.ajax({  
			  type:"post",  
			  url:"{:U('Term/displaynav')}",  
			  dataType: "json",
			  data:{
			      displaynav:0, 
				  navid:$(this).val(), 

			    },  
                 });
			  alert('导航隐藏成功');	
		    }
			
			
			
	});  
	<!-- 导航显示结束-->
	
	     <!-- 置顶显示开始-->
	$(".top_ok").click(function(){
		   if($('.top_ok').is(':checked') == true) {  
			$.ajax({  
			  type:"post",  
			  url:"{:U('Term/topok')}",  
			  dataType: "json",
			  data:{
			      top:1, 
				  topid:$(this).val(), 
			    },				
                 });
			alert('置顶成功');	
		 }else if($('.top_ok').is(':checked') == false){
		 	$.ajax({  
			  type:"post",  
			  url:"{:U('Term/topok')}",  
			  dataType: "json",
			  data:{
			      top:0, 
				  topid:$(this).val(),  

			    },  
                 });
			  alert('置顶取消');	
		    }
			
			
			
	});  
	<!-- 置顶显示结束-->
	
		     <!-- 推荐显示开始-->
	$(".rec_ok").click(function(){
		   if($('.rec_ok').is(':checked')) {
            	   
			$.ajax({  
			  type:"post",  
			  url:"{:U('Term/topok')}",  
			  dataType: "json",
			  data:{
			      top:1, 
				  topid:$(this).val(), 
			    },  
                 });
			alert('推荐成功');	
		 }else{
		 	$.ajax({  
			  type:"post",  
			  url:"{:U('Term/topok')}",  
			  dataType: "json",
			  data:{
			      top:0, 
				  topid:$(this).val(),  

			    },  
                 });
			  alert('推荐取消');	
		    }
			
			
			
	});  
	<!-- 推荐显示结束-->



	
	   
});
     <!-- 排序开始-->
	$(".listorder").change(function(){
			$.ajax({  
			  type:"post",  
			  url:"{:U('Term/listorder')}",  
			  dataType: "json",
			  data:{
				  listorder:$(this).val(),
				  listorder_id:$(this).data("orderid"),	  
			  },  
			  success:　
			  function(data){
			   alert("修改排序成功");
			  },

		   });
		   
	});
	 <!-- 排序结束-->
</script> 
</section>
    {/block}
